package initialize

import (
	"github.com/gin-gonic/gin"
	"go_es/server/middleware"
	"go_es/server/router"
)

func Routers() *gin.Engine  {
	Router := gin.Default()
	systemRouter := router.RouterGroupApp
	PublicGroup := Router.Group("")

	{
		systemRouter.InitBaseRouter(PublicGroup)
	}

	PrivateGroup := Router.Group("")
	PrivateGroup.Use(middleware.JWTAuth())
	{
		systemRouter.InitMenuRouter(PrivateGroup)
		systemRouter.InitUserRouter(PrivateGroup)
		systemRouter.InitWeiBoRouter(PrivateGroup)
		systemRouter.InitJwtRouter(PrivateGroup)
		systemRouter.InitAuthorityRouter(PrivateGroup)
		systemRouter.InitApiRouter(PrivateGroup)   // 注册功能api路由
		systemRouter.InitCasbinRouter(PrivateGroup)
	}

	return Router
}